
 
 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   R e s t o r e d   b y   L o a d V a r s 
 
 N u m e r i c   D u t y C y c l e 1 
 
 N u m e r i c   D u t y C y c l e 2 
 
 N u m e r i c   L i n e a r i t y   =   0 . 5 
 
 N u m e r i c   S m o o t h i n g   =   0 . 3 
 
 N u m e r i c   T r i m F r e q   =   8 0 0 
 
 
 
 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   L o a d   V a r s 
 
 L o a d   V a r s 
 
 
 
 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   N o t   a f f e c t e d   b y   L o a d V a r s 
 
 N u m e r i c   C o m m a n d s T e x t S l o t   =   1 0 0 
 
 N u m e r i c   S l o t _ V a l u e 1   =   1 1 0 
 
 N u m e r i c   S l o t _ V a l u e 2   =   1 1 1 
 
 N u m e r i c   S l o t _ D u t y 1   =   1 2 0 
 
 N u m e r i c   S l o t _ D u t y 2   =   1 2 1 
 
 L i n e a r i t y   =   0 . 7 
 
 S m o o t h i n g   =   0 . 1 
 
 T r i m F r e q   =   8 0 0 
 
 
 
 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   B u t t o n s 
 
 B u t t o n   2   L a b e l   T r i m C a p a c i t o r 1 
 
 B u t t o n   2   I m a g e 0 S   B u t t o n 1 . p n g 
 
 B u t t o n   2   T e x t   " T r i m   c a p .   1 " 
 
 
 
 B u t t o n   3   L a b e l   T r i m C a p a c i t o r 2 
 
 B u t t o n   3   I m a g e 0 S   B u t t o n 1 . p n g 
 
 B u t t o n   3   T e x t   " T r i m   c a p .   2 " 
 
 
 
 B u t t o n   5   L a b e l   C a l i b r a t e Z e r o 
 
 B u t t o n   5   I m a g e 0 S   B u t t o n 1 . p n g 
 
 B u t t o n   5   T e x t   " C a l i b r a t e   z e r o " 
 
 
 
 C o n t r o l s   S e t B a c k C o l o r   2 5 0   2 5 5   2 2 0 
 
 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   L o a d   A p p s 
 
 L o a d   T h e r e m i n o _ T h e r e m i n . e x e 
 
 L o a d   T h e r e m i n o _ S l o t V i e w e r . e x e 
 
 ' L o a d   T h e r e m i n o _ S i g n a l S c o p e . e x e 
 
 
 
 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   S t a r t 
 
 O p e n C o m P o r t 
 
 S e n d O p t i o n s 
 
 E n a b l e S e r i a l D a t a 
 
 W a i t   S e c o n d s   0 . 5 
 
 C a l i b r a t e Z e r o 
 
 G o t o   L o o p 
 
 S t o p 
 
 
 
 L a b e l   E v e n t S t o p 
 
 	 D i s a b l e S e r i a l D a t a 
 
 	 S a v e   V a r s 
 
 	 S e n d O p t i o n s 
 
 	 C O M   C l o s e 
 
 	 S l o t   S l o t _ V a l u e 1   =   0 
 
 	 S l o t   S l o t _ V a l u e 2   =   0 
 
 E n d 
 
 
 
 
 
 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   B u t t o n   e x e c u t i o n 
 
 
 
 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   S e n d   C o m m a n d s 
 
 L a b e l   E n a b l e P w m 
 
 	 C O M   W r i t e S t r i n g   " E N A B L E _ P W M "   +   C R L F 
 
 R e t u r n 
 
 
 
 L a b e l   D i s a b l e P w m 
 
 	 C O M   W r i t e S t r i n g   " D I S A B L E _ P W M "   +   C R L F 
 
 R e t u r n 
 
 
 
 L a b e l   D i s a b l e S e r i a l D a t a 
 
 	 C O M   W r i t e S t r i n g   " D I S A B L E _ S E R I A L _ D A T A "   +   C R L F 
 
 R e t u r n 
 
 
 
 L a b e l   E n a b l e S e r i a l D a t a 
 
 	 C O M   W r i t e S t r i n g   " E N A B L E _ S E R I A L _ D A T A "   +   C R L F 
 
 R e t u r n 
 
 
 
 L a b e l   T r i m C a p a c i t o r 1 
 
 	 C O M   W r i t e S t r i n g   " T R I M _ C A P 1 "   +   C R L F 
 
 R e t u r n 
 
 
 
 L a b e l   T r i m C a p a c i t o r 2 
 
 	 C O M   W r i t e S t r i n g   " T R I M _ C A P 2 "   +   C R L F 
 
 R e t u r n 
 
 
 
 L a b e l   C a l i b r a t e Z e r o 
 
 	 C O M   W r i t e S t r i n g   " C A L I B R A T E "   +   C R L F 
 
 R e t u r n 
 
 
 
 
 
 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   S e n d   O p t i o n s 
 
 L a b e l   S e n d O p t i o n s 
 
 	 ' P r i n t O p t i o n s 
 
 	 S e n d O p t i o n s T o D r i v e r M o d u l e 
 
 R e t u r n 
 
 
 
 L a b e l   S e n d O p t i o n s T o D r i v e r M o d u l e 
 
 	 S t r i n g   C m d   =   D u t y C y c l e 1   +   "   "   +   D u t y C y c l e 2 
 
 	 C m d   =   C m d   +   "   "   +   L i n e a r i t y   +   "   "   +   S m o o t h i n g   +   "   "   +   T r i m F r e q 
 
 	 C O M   W r i t e S t r i n g   " O P T I O N S   "   +   C m d     +   C R L F 
 
 R e t u r n 
 
 
 
 L a b e l   P r i n t O p t i o n s 
 
 	 C m d   =   " " 
 
 	 C m d   =   C m d   +   C R L F 
 
 	 C m d   =   C m d   +   P a d R i g h t ( "   D u t y 1 = "   +   D u t y C y c l e 1 ,   1 0 ) 
 
 	 C m d   =   C m d   +   P a d R i g h t ( "   D u t y 2 = "   +   D u t y C y c l e 2 ,   1 0 ) 
 
 	 C m d   =   C m d   +   P a d R i g h t ( "   L i n e a r i t y = "   +   L i n e a r i t y ,   1 0 ) 
 
 	 C m d   =   C m d   +   P a d R i g h t ( "   S m o o t h i n g = "   +   S m o o t h i n g ,   1 0 ) 
 
 	 P r i n t   C m d 
 
 R e t u r n 
 
 
 
 
 
 '   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 '     S E N D   C O M M A N D   ( d e f a u l t   t i m e o u t   =   0 . 5   S e c ) 
 
 '   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 L a b e l   S e n d C o m m a n d 
 
 	 V a r i a b l e   S t r i n g   S C 1                       ' < - -   P a r a m e t e r   C o m m a n d - S t r i n g 
 
 	 S l o t T e x t   C o m m a n d s T e x t S l o t   =   S C 1 
 
 	 V a r i a b l e   N u m e r i c   S C 2 
 
 	 F o r   S C 2   =   0 . 1   T o   0 . 5   S t e p   0 . 1   '   < - -   0 . 5   s e c o n d s   t i m e o u t 
 
 	 	 I f   S l o t T e x t ( C o m m a n d s T e x t S l o t )   =   " " 
 
 	 	 	 E x i t 
 
 	 	 E n d I f 
 
 	 	 W a i t   S e c o n d s   0 . 1 
 
 	 N e x t 
 
 R e t u r n 
 
 
 
 
 
 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 
 '     O P E N   C O M 
 
 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 
 L a b e l   O p e n C o m P o r t 
 
 	 S t r i n g     D e v i c e I D   =   " C a p D e t e c t o r 1 " 
 
 	 N u m e r i c   B a u d s         =   1 0 0 0 0 0 0 
 
 	 S t r i n g     C o m P o r t 
 
 	 N u m e r i c   C o m I n d e x 
 
 	 N u m e r i c   C o m R e t r y 1 
 
 	 N u m e r i c   C o m R e t r y 2 
 
 	 F o r   C o m R e t r y 1   =   1   T o   1 0 
 
 	 	 F o r   C o m I n d e x   =   0   T o   G e t S e p a r a t e d S t r i n g C o u n t ( C O M _ P o r t N a m e s )   -   1 
 
 	 	 	 C o m P o r t   =   G e t S e p a r a t e d S t r i n g ( C O M _ P o r t N a m e s ,   C o m I n d e x ) 
 
 	 	 	 C O M   O p e n   C o m P o r t   B a u d s 
 
 	 	 	 I f   C O M _ S t a t u s   =   " O P E N E D " 
 
 	 	 	 	 F o r   C o m R e t r y 2   =   1   T o   3 
 
 	 	 	 	 	 C O M   D i s c a r d O u t B u f f e r 
 
 	 	 	 	 	 C O M   D i s c a r d I n B u f f e r 
 
 	 	 	 	 	 C O M   W r i t e S t r i n g   " G e t I D "   +   C R L F 
 
 	 	 	 	 	 W a i t   S e c o n d s   0 . 0 1 
 
 	 	 	 	 	 I f   C O M _ R e c e i v e U n t i l ( C R L F )   =   D e v i c e I D   +   C R L F 
 
 	 	 	 	 	 	 C o m I n d e x   =   - 1 
 
 	 	 	 	 	 	 B e e p   " 4 4 0 - 1 , 0 - 8 0 , 8 8 0 - 1 " 
 
 	 	 	 	 	 	 R e t u r n 
 
 	 	 	 	 	 E n d I f 
 
 	 	 	 	 N e x t 
 
 	 	 	 E n d I f 
 
 	 	 N e x t 
 
 	 N e x t 
 
 	 I f   C o m I n d e x   > =   0 
 
 	 	 P r i n t   " C O M   P O R T   N O T   F O U N D " 
 
 	 	 T T S   S e l e c t V o i c e   " E N G F " 
 
 	 	 T T S   S p e a k   " C o m   p o r t   n o t   f o u n d . " 
 
 	 	 ' T T S   S p e a k   " P l e a s e   t e s t   c o n n e c t i o n s   a n d   r e t r y . " 
 
 	 	 W a i t   N o t   T T S s p e a k i n g 
 
 	 	 E n d 
 
 	 E n d I f 
 
 R e t u r n 
 
 
 
 '   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 '     L O O P 
 
 '   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 N u m e r i c   D e c o d e d 
 
 S t r i n g   C o m S t r 
 
 S t r i n g   D e c o d e S t r 
 
 S t r i n g   D e c o d e S t r O l d 
 
 N u m e r i c   R e p e t i t i o n s 
 
 
 
 L a b e l   L o o p 
 
 	 I f   D e c o d e C o m m a n d S l o t ( 0 )   =   " C a l i b r a t e " 
 
 	 	 C a l i b r a t e Z e r o 
 
 	 E n d I f 
 
 	 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   R e c e i v e 
 
 	 F o r   R e p e t i t i o n s   =   1   T o   I n f i n i t y 
 
 	 	 C o m S t r   =   C O M _ R e c e i v e U n t i l ( C R L F ) 
 
 	 	 I f   C o m S t r   < >   " " 
 
 	 	 	 D e c o d e S t r   =   C o m S t r 
 
 	 	 E l s e 
 
 	 	 	 E x i t 
 
 	 	 E n d I f 
 
 	 	 I f   R e p e t i t i o n s   >   5 
 
 	 	 	 C O M   O p e n   C o m P o r t   B a u d s   '   C l e a r   C O M   b u f f e r s 
 
 	 	 E n d I f 
 
 	 N e x t 
 
 	 I f   D e c o d e S t r   < >   D e c o d e S t r O l d 
 
 	 	 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   D e c o d e   1 
 
 	 	 D e c o d e d   =   G e t S e p a r a t e d S t r i n g ( D e c o d e S t r ,   0 ) 
 
 	 	 S l o t   S l o t _ V a l u e 1   =   D e c o d e d 
 
 	 	 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   D e c o d e   2 
 
 	 	 D e c o d e d   =   G e t S e p a r a t e d S t r i n g ( D e c o d e S t r ,   1 ) 
 
 	 	 S l o t   S l o t _ V a l u e 2   =   D e c o d e d 
 
 	 	 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   D e c o d e   3 
 
 	 	 D e c o d e d   =   G e t S e p a r a t e d S t r i n g ( D e c o d e S t r ,   4 ) 
 
 	 	 I f   D e c o d e d   < >   D u t y C y c l e 1 
 
 	 	 	 D u t y C y c l e 1   =   D e c o d e d 
 
 	 	 	 S l o t   S l o t _ D u t y 1   =   D e c o d e d 
 
 	 	 E n d I f 
 
 	 	 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   D e c o d e   4 
 
 	 	 D e c o d e d   =   G e t S e p a r a t e d S t r i n g ( D e c o d e S t r ,   5 ) 
 
 	 	 I f   D e c o d e d   < >   D u t y C y c l e 2 
 
 	 	 	 D u t y C y c l e 2   =   D e c o d e d 
 
 	 	 	 S l o t   S l o t _ D u t y 2   =   D e c o d e d 
 
 	 	 E n d I f 
 
 	 	 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   P r i n t 
 
 	 	 P r i n t   D e c o d e S t r 
 
 	 	 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 
 	 	 D e c o d e S t r O l d   =   D e c o d e S t r 
 
 	 E n d I f 
 
 	 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   L o o p   t i m e 
 
 	 W a i t   S e c o n d s   0 . 0 0 1 
 
 	 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   D e b u g s 
 
 	 D u t y C y c l e F r o m S l o t 
 
         ' P r i n t L o o p T i m e 
 
 G o t o   L o o p 
 
 
 
 '   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 '     D E B U G 
 
 '   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 L a b e l   P r i n t L o o p T i m e 
 
 	 N u m e r i c   n e w l o o p t i m e   =   E l a p s e d T i m e 
 
 	 N u m e r i c   l o o p t i m e   =   n e w l o o p t i m e   -   o l d l o o p t i m e 
 
 	 N u m e r i c   o l d l o o p t i m e   =   n e w l o o p t i m e 
 
 	 P r i n t   F o r m a t ( l o o p t i m e   *   1 0 0 0 ,   " 0 . 0 " ) 
 
 R e t u r n 
 
 
 
 L a b e l   D u t y C y c l e F r o m S l o t 
 
 	 I f   S l o t ( S l o t _ D u t y 1 )   < >   D u t y C y c l e 1 
 
 	 	 E n a b l e P w m 
 
 	 	 D u t y C y c l e 1   =   S l o t ( S l o t _ D u t y 1 ) 
 
 	 	 S e n d O p t i o n s 
 
 	 E n d I f 
 
 	 I f   S l o t ( S l o t _ D u t y 2 )   < >   D u t y C y c l e 2 
 
 	 	 E n a b l e P w m 
 
 	 	 D u t y C y c l e 2   =   S l o t ( S l o t _ D u t y 2 ) 
 
 	 	 S e n d O p t i o n s 
 
 	 E n d I f 
 
 R e t u r n 
 
 
 
 
 
 ' B O O K M A R K S   
 
 
 
 ' E D I T E D L I N E S   2 4 6   7   3 8   8   1 8 5   1 0   1 7 5   1 0   
 
 
 
 ' E X E C   D e s t X   =   1 2 
 
 